<template>
  <el-container class="layout-container-demo" style="height: 100vh">
    <el-aside :width="!isCollapse ? '200px' : '100px'" style="background-color:#545c64;">
      <el-scrollbar >
        <MenuList :isCollapse="isCollapse"></MenuList>
      </el-scrollbar>
    </el-aside>

    <el-container>
      <el-header style="height: 50px; line-height: 50px;">
        <el-icon size="30" style="vertical-align: middle" v-show="isCollapse" @click="isCollapse = !isCollapse">
          <Expand />
        </el-icon>
        <el-icon size="30" style="vertical-align: middle" v-show="!isCollapse" @click="isCollapse = !isCollapse">
          <Fold />
        </el-icon>
      </el-header>

      <el-main>
        <el-scrollbar>
          <router-view />
        </el-scrollbar>
      </el-main>
    </el-container>
  </el-container>
</template>

<script setup>
import { Expand, Fold } from '@element-plus/icons-vue'
import MenuList from '@/components/MenuList'
import { ref } from 'vue'
// 显示隐藏侧边栏
const isCollapse = ref(false)
const item = {
  date: '2016-05-02',
  name: 'Tom',
  address: 'No. 189, Grove St, Los Angeles'
}
const tableData = ref(Array.from({ length: 20 }).fill(item))
</script>

<style lang="scss" scoped>
.mb-2 {
  height: 50px;
}
.layout-container-demo .el-header {
  position: relative;
  background-color: var(--el-color-primary-light-7);
  color: var(--el-text-color-primary);
}
.layout-container-demo .el-aside {
  color: var(--el-text-color-primary);
  background: var(--el-color-primary-light-8);
}
.layout-container-demo .el-menu {
  border-right: none;
}
.layout-container-demo .el-main {
  padding: 0;
}
.layout-container-demo .toolbar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  right: 20px;
}
</style>
